package com.zmc.dynamic.controller;

import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.zmc.dynamic.domain.CashConfig;
import com.zmc.dynamic.domain.CashOrder;
import com.zmc.dynamic.domain.CashUser;
import com.zmc.dynamic.service.CashConfigService;
import com.zmc.dynamic.service.CashOrderService;
import com.zmc.dynamic.service.CashUserService;
import com.zmc.dynamic.util.IdUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.IntStream;

@RestController
@RequestMapping("user/")
public class UserController {

    @Resource
    private CashUserService cashUserService;

    @RequestMapping("save")
    public String save(){

        IntStream.range(0,100).forEach(i->{
            CashUser cashUser = new CashUser();
            cashUser.setUserId("1111111111");
            cashUser.setName("wangWu");
            cashUser.setCreateBy("maLiu");
            cashUser.setUpdateBy("shenQi");
            cashUserService.save(cashUser);
        });

        return "ok";
    }

    @RequestMapping("get")
    public String get(){
        List<CashUser> list = cashUserService.list();
        return JSON.toJSONString(list);
    }
}
